<?php
session_start();
if(isset($_POST["logIn"]))
{
	$loginError = User::checkUserNameAndPassword($_POST["user_name"], md5($_POST["password"]));
	if($loginError !== true)
	{
		echo "<font-color='#ff0000'>".$loginError."</font>";
	}
	else
	{
		
		$user = new User($_POST["user_name"]);
		$_SESSION["user"] = $user;
	}
	$referer = $_SERVER['HTTP_REFERER'];
	if (!$referer == '') {
		header('Location: '.$referer);
	} 
	else {
		?><script type="text/javascript">history.go(-1);</script><?php
	}

	exit();
}



?>